-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Slack token detector #122
Conversation
Add Slack token detector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff! 🚢
class SlackDetector(RegexBasedDetector): | ||
secret_type = 'Slack Token' | ||
blacklist = ( | ||
re.compile(r'xox(?:a|b|p|o|s|r)-(?:\d+-)+[a-z0-9]+', flags=re.IGNORECASE), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nit: We could add length ranges but I couldn't find out how much they vary, e.g. the last field might not be more than 32 chars. I rather we lean towards false-positives and iterate though, i.e. ship as-is 👍 (not that I think there will be any false-positives, since xox
is sort of rare)
cc @dxa4481, in case you want to compare with your truffleHogRegex
detect_secrets/core/usage.py
Outdated
PluginDescriptor( | ||
classname='SlackDetector', | ||
disable_flag_text='--no-slack-scan', | ||
disable_help_text='Disables scanning for secret slack.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Maybe Disables scanning for Slack tokens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in the latest commit 2dd3ef8
Add Slack token detector.
CC @jribm